import { getUserInfo } from '@/utils/cookie'

export default {
  data () {
    return {
      userInfo: null,
    }
  },
  created () {
    let userInfo = getUserInfo()
    if (userInfo && Object.keys(userInfo).length > 0) {
      userInfo = JSON.parse(userInfo)
      this.userInfo = userInfo
      if(!this.$store) return
      if (!this.$store.state.userInfo) {
        this.$store.dispatch('userInfo', userInfo)
      }
    }
  },
}
